﻿#ifndef PARAMETERRECOND_H
#define PARAMETERRECOND_H
#include <QObject>
#include <QVariantList>
#include <QAbstractTableModel>
#include <QHash>
#include <QVariant>
#include <QObject>
using namespace std;
struct SimpleData
{
    int m_id;
    QString m_time;
    QString m_operator;
    double m_so2min;
    double m_so2max;
    double m_noxmin;
    double m_noxmax;
    double m_particulatesmin;
    double m_particulatesmax;
    double m_o2min;
    double m_o2max;
    double m_comin;
    double m_comax;
};


class ParameterRecord : public QAbstractTableModel
{
    Q_OBJECT
public:
    explicit ParameterRecord(QAbstractTableModel *parent=0);
    //MyModel();
    Q_INVOKABLE void update(void);
    Q_INVOKABLE void setStartTime(QString s_time);
    Q_INVOKABLE void setEndTime(QString e_time);
    int rowCount(const QModelIndex & parent = QModelIndex()) const Q_DECL_OVERRIDE;
    int columnCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
    QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
    QHash<int, QByteArray> roleNames() const Q_DECL_OVERRIDE;
    void getData(void);
    enum Role {
        IdRole=Qt::UserRole + 1,
        TimeRole,
        OperatorRole,
        SO2MaxRole,
        SO2MinRole,
        COMaxRole,
        COMinRole,
        NOXMaxRole,
        NOXMinRole,
        ParticulatesMaxRole,
        ParticulatesMinRole,
        O2MaxRole,
        O2MinRole
    };
private:
    QList<SimpleData> model_data;
    string StartTime;
    string EndTime;
};

#endif // PARAMETERRECOND_H
